<template>
  <div style="line-height: 0;">
    <div style="margin-top: 15px; margin-bottom: 15px; line-height: 0; text-align: left;">
      <el-row>

        <label>订单编号：</label>
        <el-input style="width: 200px;" prefix-icon="el-icon-search" v-model="params.orderCode" placeholder="请输入订单编号"></el-input>
        &nbsp;&nbsp;&nbsp;
        <el-button type="warning" round style="margin-left: 10px;" @click="findevaluate">查询</el-button>
        &nbsp;&nbsp;&nbsp;
        <el-button type="warning" round style="margin-left: 10px;" @click="reset()">重置</el-button>
      </el-row>
    </div>
    <div>
      <el-table
          :data="tableData"
          border
          style="width: 100%">
        <el-table-column prop="evaluate_id" v-if="false"></el-table-column>
        <el-table-column prop="orderCode" label="订单编号" width="160"></el-table-column>
        <el-table-column prop="checkSpeed" label="订单效率评分" width="160"></el-table-column>
        <el-table-column prop="orderPrice" label="树苗价格评分" width="160"></el-table-column>
        <el-table-column prop="userMeet" label="用户满意程度" width="160"></el-table-column>
        <el-table-column prop="treeQuality" label="树苗质量评分" width="160"></el-table-column>
        <el-table-column prop="guideService" label="导购服务评分" width="160"></el-table-column>
        <el-table-column prop="suggestion" label="建议内容" width="160"></el-table-column>
        <el-table-column prop="evaluateStatusValue" label="反馈状态" width="160"></el-table-column>
        <el-table-column label="具体信息">
          <template slot-scope="scope">
            <el-button type="danger" @click="cancel(scope.row)">取消推荐</el-button>

          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="block" style="text-align: center;">
      <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="params.pageNum"
          :page-sizes="[5, 10, 15, 20]"
          :page-size="params.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
      </el-pagination>
    </div>

  </div>

</template>
<script>

import {list} from "postcss";
import request from "@/utils/request";

export default {
  computed: {
    list() {
      return list
    }
  },

  data() {
    return {
      user: sessionStorage.getItem("user")? JSON.parse(sessionStorage.getItem("user")):{},
      params: {
        orderCode: '',
        treetypename:'',
        pageNum: 1,
        pageSize: 10
      },
      tableData:[],
      sumScore: 0,
      total: 0,
      formLabelWidth: '190px',
    }
  },
  //在页面加载的时候，做一些事情
  created() {
    this.findevaluate();
  },
  //定义一些页面上触发事件调用的方法
  methods:{
    findevaluate(){
      request.post("/order/findevaluate/" + this.user.userId,this.params).then(res => {
        if (res.code === '0') {
          this.tableData = res.data.list;
          this.total = res.data.total;
        } else {
          this.$message.error(res.msg)
        }
      })

    },
    reset() {
      this.params = {
        pageNum: 1,
        pageSize: 10,
        treename: '',
        username: '',
      }
      this.findevaluate();
    },
    cancel(obj){
      console.log(obj.evaluateId)
      request.post("/order/cancelevaluate/" + obj.evaluateId).then(res => {
        if (res.code === '0') {
          this.$message.success("已为您取消建议")
        } else {
          this.$message.error(res.msg)
        }
      })
      this.findevaluate();
    },
    handleSizeChange(){

    },
    handleCurrentChange(){

    },


  }
}
</script>